package com.cn.serverline.lineicp.productionLine.enums;

import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import lombok.Getter;

/**
 * @author Gmr
 * @since 2024/7/30
 */
@Getter
public enum ProcessStageEnum {

	FINAL_ASSEMBLY(0L, "总装"),
	DEPARTMENT_EQUIPMENT(1L, "部装");

	private final Long code;
	private final String message;

	ProcessStageEnum(Long code, String message) {
		this.code = code;
		this.message = message;
	}

	/**
	 * 校验工艺阶段
	 *
	 * @param code 工艺阶段
	 */
	public static void validate(Long code){
		for (ProcessStageEnum value : ProcessStageEnum.values()) {
			if (value.getCode().equals(code)) {
				return;
			}
		}
		throw new ServiceException(ProductMixException.UNKNOWN_PROCESS_STAGE);
	}
}
